package com.boil.qz.safekavass.service;

import com.boil.qz.safekavass.dao.MybatisDao;
import com.boil.qz.safekavass.pojo.LearnCountVo;
import com.boil.qz.safekavass.pojo.LearnPersonVo;
import com.boil.util.Page;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * Created by ChenYong on 2017-05-23.
 * <br>
 * 题库学习记录 Service。
 */
@Service
public class QuestionResRecordService {
    /**
     * 注入 Mybatis Dao
     */
    @Autowired
    private MybatisDao mybatisDao;

    /**
     * 根据学习时间查询学习统计。
     *
     * @param startTime 开始时间
     * @param endTime   结束时间
     * @return 学习统计
     */
    public List<LearnCountVo> findLearnCountByLearnTime(String startTime, String endTime) {
        Map<String, Object> map = new HashMap<String, Object>();
        map.put("startTime", startTime);
        map.put("endTime", endTime);

        return mybatisDao.selectList("questionResRecordNs.findLearnCountByLearnTime", map);
    }

    /**
     * 根据学习日期分页查询学习人。
     *
     * @param page 分页实例
     */
    public void findLearnPersonByLearnTimeInPage(Page<LearnPersonVo> page) {
        mybatisDao.selectInPage("questionResRecordNs.findLearnPersonByLearnTimeInPage", page);
    }
}